package custom.DeleteLevel;



import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
//import com.l2jserver.gameserver.model.itemcontainer.Inventory;
//import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.actor.stat.PcStat;
import com.l2jserver.gameserver.model.actor.status.PcStatus;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;

public class DeleteLevel extends Quest
{
		private static final int _Npc_delete = 10004;
		//private static final int _set_level = 70;
		//private static byte _level = Byte.parseByte(70);
		//private static byte _level = 70;
//

		public DeleteLevel(int questId, String name, String descr)
		{
			super(questId, name, descr);
			addStartNpc(_Npc_delete);
			addFirstTalkId(_Npc_delete);
			addTalkId(_Npc_delete);
			/*for (Location loc : _spawns)
			{
				addSpawn(_Npc_delete, loc, false, 0);
			}*/
		}





		@Override
		//public String onAdvEvent(String event, L2Npc npc, PcStat addLevel)
			public onAdvEvent(String event, L2Npc npc, L2PcInstance player)
		{
			String htmltext = event;
			//int level = player.getLevel();
			
			
			QuestState st = player.getQuestState(getName());
			if (event.equalsIgnoreCase("delete_level"))
			{
				if (player.getLevel() > 70)
				
				//if ( level > 70)
				{
					player.getStat().setLevel((byte) 1);
					//player.getStatus().setLevel("(byte)70");
					//st.setLevel(Byte.parseByte(70)); 
					player.addExpAndSp(810000, 50000);
					//player.sendPacket(SystemMessage.sendString("_______TEST OK_____"));	
					player.sendPacket(SystemMessage.sendString(" เลเวลของ " + player.getName() + " ลดเหลือ 70"));
					player.sendPacket(SystemMessage.sendString("_____: ของคุณที่ใช้บริการกับ RDF Delete Level :_____"));	
				}
			}
			
			
			

					player.sendPacket(SystemMessage.sendString(" Error : เลเวลของ " + player.getName() + " ไม่ถึง 70"));



			//return htmltext;
		}

		@Override
		public String onFirstTalk(L2Npc npc, L2PcInstance player)
		{
			if (player.getQuestState(getName()) == null)
			{
				newQuestState(player);
			}
			return npc.getNpcId() + ".htm";
		}
		
		public static void main(String[] args)
		{
			new DeleteLevel(-1, "DeleteLevel", "custom"); // new DeleteLevel(-1, "DeleteLevel", "events");
		}
}
